<template>
  <div class="person">
    <el-card class="main-card" shadow="always">
      <el-card
        class="left-card"
        shadow="never"
        :body-style="{ padding: '20px' }"
      >
        <div class="item">
          <div class="user-info">
            <img class="avatar" :src="userInfo.icon" alt="">
            <p>{{ userInfo.username }}</p>
          </div>
          <div class="tag-list">
            <div class="tag-item">
              <i class="el-icon-collection-tag" />
              <span>交互专家</span>
            </div>
            <div class="tag-item">
              <i class="el-icon-s-check" />
              <span>不凡学院－某某某事业群－某某平台部－某某技术部－UED</span>
            </div>
            <div class="tag-item">
              <i class="el-icon-location-outline" />
              <span> 河南省 郑州市 金水区 绿地新都会</span>
            </div>
          </div>
        </div>
        <div class="item">
          <p>标签</p>
          <el-tag
            v-for="tag in dynamicTags"
            :key="tag"
            closable
            size="mini"
            :disable-transitions="false"
            @close="handleClose(tag)"
          >
            {{ tag }}
          </el-tag>
          <el-input
            v-if="inputVisible"
            ref="saveTagInput"
            v-model="inputValue"
            class="input-new-tag"
            size="mini"
            @keyup.enter.native="handleInputConfirm"
            @blur="handleInputConfirm"
          />
          <el-button
            v-else
            class="button-new-tag"
            size="mini"
            @click="showInput"
          >+ New Tag</el-button>
        </div>
        <div class="item">
          <div class="link-list">
            <div class="link-item">
              <img
                src="https://bufan-apitown.oss-cn-beijing.aliyuncs.com/bftec/20201120152029983801.jpg"
                alt=""
              >
              <span>不凡UI设计组</span>
            </div>
            <div class="link-item">
              <img
                src="https://bufan-apitown.oss-cn-beijing.aliyuncs.com/bftec/20201120152042345120151821.jpg"
                alt=""
              >
              <span>不凡前端开发组</span>
            </div>
            <div class="link-item">
              <img
                src="https://gw.alipayobjects.com/zos/rmsportal/WdGqmHpayyMjiEhcKoVE.png"
                alt=""
              >
              <span>阿里支付组</span>
            </div>
            <div class="link-item">
              <img src="https://cn.vuejs.org/images/logo.png" alt="">
              <span>vue小组</span>
            </div>
            <div class="link-item">
              <img
                src="https://gw.alipayobjects.com/zos/rmsportal/zOsKZmFRdUtvpqCImOVY.png"
                alt=""
              >
              <span>全员都是吴彦祖</span>
            </div>
            <div class="link-item">
              <img
                src="https://gw.alipayobjects.com/zos/rmsportal/siCrBXXhmvTQGWPNLBow.png"
                alt=""
              >
              <span>高逼格天团</span>
            </div>
          </div>
        </div>
      </el-card>
      <el-card
        class="right-card"
        shadow="never"
        :body-style="{ padding: '20px' }"
      >
        <el-tabs v-model="activeName">
          <el-tab-pane label="文章" name="first">
            <div class="article-list">
              <div v-for="item in 8" :key="item" class="article-item">
                <p class="title">Vue</p>
                <div class="article-tag">
                  <el-tag size="mini">Element</el-tag>
                  <el-tag size="mini">饿了么</el-tag>
                  <el-tag size="mini">设计语言</el-tag>
                </div>
                <p class="text">
                  段落示意：element，用最小的工作量，无缝接入蚂蚁金服生态，提供跨越设计与开发的体验解决方案。element，用最小的工作量，无缝接入蚂蚁金服生态，提供跨越设计与开发的体验解决方案。
                </p>
                <p class="author">周树人 2020-11-20 10:33</p>
                <div class="icon-holder">
                  <div class="icon-item">
                    <i class="el-icon-s-flag" />
                    <span class="icon-text">125</span>
                    <span class="line">丨</span>
                  </div>
                  <div class="icon-item">
                    <i class="el-icon-thumb" />
                    <span class="icon-text">13453</span>
                    <span class="line">丨</span>
                  </div>
                  <div class="icon-item">
                    <i class="el-icon-s-flag" />
                    <span class="icon-text">222</span>
                  </div>
                </div>
              </div>
            </div>
          </el-tab-pane>
          <el-tab-pane label="项目" name="second">
            <div class="card-list">
              <div v-for="item in 8" :key="item" class="card-item">
                <img
                  class="card-img"
                  src="https://bufan-apitown.oss-cn-beijing.aliyuncs.com/bftec/20201120163137052iXjVmWVHbCJAyqvDxdtx.png"
                  alt=""
                >
                <div class="card-bottom">
                  <div class="card-title">不凡学院</div>
                  <div class="card-text">
                    那是一种内在的东西， 他们到达不了，也无法触及的
                  </div>
                  <div class="desc-holder">
                    <div class="time">1天前</div>
                    <div class="img-holder">
                      <img
                        src="https://gw.alipayobjects.com/zos/rmsportal/siCrBXXhmvTQGWPNLBow.png"
                        alt=""
                      >
                      <img
                        src="https://bufan-apitown.oss-cn-beijing.aliyuncs.com/bftec/20201120165417366ZiESqWwCXBRQoaPONSJe.png"
                        alt=""
                      >
                      <img
                        src="https://bufan-apitown.oss-cn-beijing.aliyuncs.com/bftec/20201120152029983801.jpg"
                        alt=""
                      >
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </el-tab-pane>
        </el-tabs>
      </el-card>
    </el-card>
  </div>
</template>

<script>
import { getUserData } from '@/utils/auth'
export default {
  data() {
    return {
      activeName: 'first',
      userInfo: {},
      dynamicTags: ['不凡人', '学霸', '专业设计', '高颜值', '无所谓', '随便'],
      inputVisible: false,
      inputValue: ''
    }
  },
  created() {
    this.userInfo = getUserData()
  },
  methods: {
    handleClose(tag) {
      this.dynamicTags.splice(this.dynamicTags.indexOf(tag), 1)
    },

    showInput() {
      this.inputVisible = true
      this.$nextTick((_) => {
        this.$refs.saveTagInput.$refs.input.focus()
      })
    },

    handleInputConfirm() {
      const inputValue = this.inputValue
      if (inputValue) {
        this.dynamicTags.push(inputValue)
      }
      this.inputVisible = false
      this.inputValue = ''
    }
  }
}
</script>

<style scoped>
.el-tag + .el-tag {
  margin-left: 10px;
}
.button-new-tag {
  margin-left: 10px;
  height: 32px;
  line-height: 30px;
  padding-top: 0;
  padding-bottom: 0;
}
.input-new-tag {
  width: 90px;
  margin-left: 10px;
  vertical-align: bottom;
}
</style>
<style lang="scss" scoped>
.person {
  .main-card {
    padding: 20px 0;
    .el-card {
      margin: 0;
    }
    .el-card__body {
      padding: 0px;
    }
    .left-card {
      padding: 20px 0;
      float: left;
      width: 30%;

      .item {
        padding: 20px 0;
        border-bottom: 1px dashed rgba(0, 0, 0, 0.06);
        .user-info {
          margin-top: 10px;
          .avatar {
            display: block;
            margin: 0 auto;
            width: 100px;
            height: 100px;
            border: 1px solid #c0c4cc;
            border-radius: 50%;
          }

          p {
            text-align: center;
            font-size: 20px;
          }
        }

        .tag-list {
          margin-top: 10px;
          font-size: 13px;

          .tag-item {
            margin-top: 10px;
          }
        }

        .link-list {
          .link-item {
            margin-top: 16px;
            width: 50%;
            float: left;
            display: flex;
            align-items: center;
            img {
              display: block;
              width: 25px;
              height: 25px;
              border-radius: 50%;
            }
            span {
              margin-left: 10px;
            }
          }
        }
      }
    }
    .right-card {
      margin-left: 20px;
      float: left;
      width: 68%;

      .article-list {
        padding: 10px;
        .article-item {
          padding-bottom: 10px;
          border-bottom: 1px dashed grey;
          .author {
            font-size: 13px;
            text-align: right;
            color: rgba(0, 0, 0, 0.45);
          }

          .icon-holder {
            display: flex;
            color: rgba(0, 0, 0, 0.45);
            font-size: 14px;
          }
        }
      }

      .card-list {
        width: 100%;
        overflow: hidden;
        .card-item:nth-child(4n+1) {
          margin: 10px 0px;
        }
        .card-item {
          margin: 10px;
          float: left;
          box-sizing: border-box;
          width: 23%;
          height: 275px;
          border: 1px solid #ebeef5;
          border-radius: 4px;
          cursor: pointer;
          .card-img {
            width: 100%;
            height: 175px;
          }
          .card-bottom {
            .card-title {
              margin: 4px;
              color: #303133;
            }
            .card-text {
              margin: 4px;
              color: #303133;
              font-size: 12px;
            }
            .desc-holder {
              display: flex;
              justify-content: space-between;
              align-items: center;

              .time {
                font-size: 12px;
                color: gray;
                margin-left: 5px;
              }

              .img-holder {
                position: relative;
                margin-right: 20px;
                img {
                  width: 20px;
                  height: 20px;
                  border-radius: 50%;
                  margin-left: -5px;
                }
              }
            }
          }
        }
      }
    }
  }
}
</style>
